#=============================================================================
# StripExperiment PROJECT's MAKEFILE of main
# 
# [About Each Argument]
#	all (nothing)
#	 If you type this argument, Makefile will compile all source and link
#	 object file and library.
#	clean
#	 If you type this argument, Makefile will erase all object files.
#	install
#	 If you type this argument, Makefile will install StripExperiment
#	 And create data & log directory for Applicationw under home directory.
#	uninstall
#	 If you type this argument, Makefile will erase StripExperiment.elf
#	 installed and data & log directory for Applicationw
#
# author suzuki ryoutoku
#=============================================================================


#=============================================================================
# To set common value in this project
#=============================================================================
# this directory is root directory of project.
base_directory := $(shell pwd)

# this directory is outputed object file
objects_directory := $(base_directory)/object

# this directory is outputed depend file
depends_directory := $(objects_directory)/depend

# this directory is exist source file
source_directory := $(base_directory)/source

# to carry directory parameter for inferiority directory 
export source_directory
export base_directory
export objects_directory
export depends_directory


# library directory path
library_directory := $(source_directory)/library
export library_directory


# for path of file
GNOME_COMPILE_CONFIG := $(shell pkg-config gtkglext-1.0 --cflags)
export GNOME_COMPILE_CONFIG



# compile & command
CC := g++
export CC
SHELL = /bin/sh
export SHELL

# special value
PROJECT = StripExperiment
FILE_NAME = $(base_directory)/StripExperiment.elf
export PROJECT
export FILE_NAME

#=============================================================================
# target & rule
#=============================================================================
build : all

all :
	make -C source/ 
	make DEBUG=1 -C object/

release :
	make -C source/ 
	make -C object/

.PHONY : clean

clean : 
	rm -f object/*.o
	rm -f object/*.elf
	rm -f object/depend/*.d
	rm -f $(FILE_NAME)
	rm -f $(base_directory)/stripexperiment.log
	rm -f $(base_directory)/document/en/instruction_book.aux
	rm -f $(base_directory)/document/en/instruction_book.log
	rm -f $(base_directory)/document/en/instruction_book.toc
	rm -f $(base_directory)/document/en/instruction_book.out
	rm -f $(base_directory)/document/en/instruction_book.dvi
	rm -f $(base_directory)/document/ja/instruction_book.aux
	rm -f $(base_directory)/document/ja/instruction_book.log
	rm -f $(base_directory)/document/ja/instruction_book.toc
	rm -f $(base_directory)/document/ja/instruction_book.out
	rm -f $(base_directory)/document/ja/instruction_book.dvi

install : release
	install -d $(HOME)/.$(PROJECT)
	cp -rp data.jpg $(HOME)/.$(PROJECT)/
	@echo $(DESTDIR)
	install -d $(DESTDIR)/usr/local/bin
	install $(FILE_NAME) $(DESTDIR)/usr/local/bin

uninstall :
	rm -rf $(HOME)/.$(PROJECT)
	rm $(DESTDIR)/usr/local/bin/$(PROJECT).elf

